﻿ <script type="text/javascript" src="${siteurl}Assets/Scripts/comment.js"></script>
<h3>评论</h3>


    <h3 id="comments">评论列表(${comments.count})</h3>
    <ul id="commentlist">
        #foreach($item in $comments)
        <li id="comment-${item.id}"  class="alt" >
            <div class="comment-meta">
                <span class="comment-author">${item.Name}</span>
                <span class="comment-date" >${item.CreateDate.tostring("yyyy-MM-dd HH:mm")}</span>
                <span class="comment-replay"><a class="reviewto"  href="#commentcontent">回复</a></span>
            </div>
            <p>
                #if($item.Staus==1)
                    ${item.content}
                #else
                    [待审核]
                #end
            </p>
        </li>
        #end
    </ul>

     #if($comments.count==0)
        <p>暂无评论</p>
     #end
    
    ${pager}

#if(${post.commentstatus}==1)
<p>
 <span id="comment-nologin">
     <a href="/users/login.aspx">登录</a> | 
     <a href="/users/register.aspx">注册</a>
</span>
    <input type="hidden" id="targetid" value="${post.ID}" />
    <label>昵称</label>
    <input name="username" id="username" value="" type="text" size="30" />
<!--    <label>邮件</label>
    <input name="usermail" id="usermail" value="Your Email" type="text" size="30" />-->
    <label>写点什么</label>
    <textarea id="commentcontent" name="commentcontent" rows="5" cols="5"></textarea>
    <br />
    <input class="button" type="button" id="addcomment" value="提交评论" onclick="return addComment();" />
</p>
#else
<p>禁止评论</p>
#end
<br />
<script type="text/javascript">
    var ucookies = getCookies("User", "name");
    if (ucookies != "" && ucookies != null) {
        this.document.getElementById("comment-nologin").style.display = "none";
        $("#username").attr("value", ucookies);

    }
    else {
        this.document.getElementById("comment-nologin").style.display = "";

    }

    $(".reviewto").bind("click", function () {
        var author = $(this).parents().siblings(".comment-author").text();
        $("#commentcontent").attr("value", "@" + author)

        $("#commentcontent").focus();

    });

    
</script>